// Regex for default commits.
const RE_DEFAULT_COMMIT =
    /^(?::.*:|(?:\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff]))\s(?<emoji> (?<type>.*)\s)?.*$/gm

export default {
    extends: [],
    prompt: {
        path: './.czrc'
    },
    rules: {
        'cz-emoji': [2, 'always']
    },
    plugins: [
        {
            rules: {
                'cz-emoji': ({ raw }) => {
                    const isValid = RE_DEFAULT_COMMIT.test(raw)

                    const message = `Your commit message should be: <emoji> <type>: <subject>`

                    return [isValid, message]
                }
            }
        }
    ]
}
